package com.yc.rh.entities;

import com.yc.rh.filters.ContentSafeFilter;

public class CommentsInfo {
	private int csid;//评论的id
	private int usid;//评论人的id
	private int naid;//评论的照片的id
	private String cscontents;//评论的内�?
	private String csdate;//评论的时�?
	private String temp;//备注
	private String text1;//预留字段
	private String text2;//
	
	private ContentSafeFilter cr=new ContentSafeFilter();
	
	@Override
	public String toString() {
		return "CommentsInfo [csid=" + csid + ", usid=" + usid + ", naid="
				+ naid + ", cscontents=" + cscontents + ", csdate=" + csdate
				+ ", temp=" + temp + ", text1=" + text1 + ", text2=" + text2
				+ "]";
	}


	public CommentsInfo(int csid, int usid, int naid, String cscontents,
			String csdate, String temp, String text1, String text2) {
		super();
		this.csid = csid;
		this.usid = usid;
		this.naid = naid;
		this.cscontents = cscontents;
		this.csdate = csdate;
		this.temp = temp;
		this.text1 = text1;
		this.text2 = text2;
	}


	public CommentsInfo() {
		super();
	}


	public int getCsid() {
		return csid;
	}


	public void setCsid(int csid) {
		this.csid = csid;
	}


	public int getUsid() {
		return usid;
	}


	public void setUsid(int usid) {
		this.usid = usid;
	}


	public int getNaid() {
		return naid;
	}


	public void setNaid(int naid) {
		this.naid = naid;
	}


	@SuppressWarnings("static-access")
	public String getCscontents() {
		return cr.filter(cscontents);
	}


	public void setCscontents(String cscontents) {
		this.cscontents = cscontents;
	}


	public String getCsdate() {
		if(csdate!=null && csdate.contains(".")){
			csdate=csdate.substring(0, csdate.indexOf("."));
		}
		return csdate;
	}

	public void setCsdate(String csdate) {
		this.csdate = csdate;
	}


	public String getTemp() {
		return temp;
	}


	public void setTemp(String temp) {
		this.temp = temp;
	}


	public String getText1() {
		return text1;
	}


	public void setText1(String text1) {
		this.text1 = text1;
	}


	public String getText2() {
		return text2;
	}


	public void setText2(String text2) {
		this.text2 = text2;
	}


	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((cscontents == null) ? 0 : cscontents.hashCode());
		result = prime * result + ((csdate == null) ? 0 : csdate.hashCode());
		result = prime * result + csid;
		result = prime * result + naid;
		result = prime * result + ((temp == null) ? 0 : temp.hashCode());
		result = prime * result + ((text1 == null) ? 0 : text1.hashCode());
		result = prime * result + ((text2 == null) ? 0 : text2.hashCode());
		result = prime * result + usid;
		return result;
	}


	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		CommentsInfo other = (CommentsInfo) obj;
		if (cscontents == null) {
			if (other.cscontents != null)
				return false;
		} else if (!cscontents.equals(other.cscontents))
			return false;
		if (csdate == null) {
			if (other.csdate != null)
				return false;
		} else if (!csdate.equals(other.csdate))
			return false;
		if (csid != other.csid)
			return false;
		if (naid != other.naid)
			return false;
		if (temp == null) {
			if (other.temp != null)
				return false;
		} else if (!temp.equals(other.temp))
			return false;
		if (text1 == null) {
			if (other.text1 != null)
				return false;
		} else if (!text1.equals(other.text1))
			return false;
		if (text2 == null) {
			if (other.text2 != null)
				return false;
		} else if (!text2.equals(other.text2))
			return false;
		if (usid != other.usid)
			return false;
		return true;
	}
	
	
}
